package org.xshop.web;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.xshop.model.TGoodsLimit;
import org.xshop.service.ITGoodsLimitService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import top.ibase4j.core.base.AppBaseController;
import top.ibase4j.core.util.DataUtil;
import top.ibase4j.core.util.WebUtil;

/**
 * <p>
 * 商品热搜 前端控制器
 * </p>
 *
 * @author Liux
 * @since 2018-05-16
 */
@Controller
@RequestMapping("/app/goods/")
@Api(tags = "GoodsLimit", value = "商品限购", description = "商品限购")
public class TGoodsLimitController extends AppBaseController<TGoodsLimit, ITGoodsLimitService> {
    @ApiOperation(value = "商品限购列表", notes = "商品限购列表", produces = MediaType.APPLICATION_JSON_VALUE, response = TGoodsLimit.class)
    @RequestMapping(value = "listlimit.api", method = { RequestMethod.GET, RequestMethod.POST })
    public Object list(HttpServletRequest request) {
        Map<String, Object> param = WebUtil.getParameter(request);
        Long memberId = getCurrUser(request);
        if (DataUtil.isNotEmpty(memberId)) {
            param.put("memberId", memberId);
        }
        Object result = service.getAllGoods(param);
        return setSuccessModelMap(result);
    }

}
